package net.dgg.dggcloud.service.jrcrm.utils;


import net.dgg.dggcloud.service.common.exception.BizException;
import net.dgg.dggcloud.service.common.util.HttpUtility;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.client.methods.HttpPost;

import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;

/**
 * 发送短信-营销
 * 
 * @author 罗金
 * 
 */
public class SmsMarketingDao {


	public String sendMsg(String mobile, String content) {
		try {
//			content = URLEncoder.encode(content, "Ut");
			String url = "http://client.cloud.hbsmservice.com:8080/sms_send2.do";
			Map params = new HashMap();
			params.put("corp_id", "dt0914");
			params.put("corp_pwd", "dg1354");
			params.put("corp_service","106922923241");
			params.put("mobile",mobile);
			params.put("msg_content",content);
			params.put("corp_msg_id ","");
			params.put("ext ","");
			String result = HttpUtility.postRest(url, params);
			return result;
		} catch (Exception e) {
			throw new BizException("短信发送失败",10001);
		}

	}


	public static void main(String[] args) {
		SmsMarketingDao s = new SmsMarketingDao();
		String body = s.sendMsg("13096323923", "测试消息：测试");
		System.out.println(body);
	}
}
